﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int n = 0;

	while (scanf("%d", &n) != EOF)
	{
		int  sum = 2;
		int  m = 2;
		for (int i = 0; i < n - 1; i++)
		{
			m += 3;
			sum += m;
		}
		printf("%d\n", sum);
	}
	return 0;
}